<template>
  <div class="wrapper">
    <div class="status">
      <img :src="require('../imgs/cg_bai_03.png')" width="45px" height="45px" class="img" alt />
      <span>操作成功</span>
    </div>
    <van-cell-group style="margin-bottom: 12px;">
      <van-cell title="订单号" :value="order.orderNum" />
      <van-cell title="账号" :value="order.userName" />
      <van-cell title="金额" :value="order.price" />
    </van-cell-group>
    <van-cell-group style="margin-bottom: 48px;">
      <van-cell title="支付状态" :value="order.status=='1'?'待支付':'已完成'" />
      <van-cell title="发货状态" :value="order.remark=='1'?'未发货':'已发货'" />
      <van-cell title="支付时间" :value="order.payTime" />
    </van-cell-group>
    <van-button block plain :to="{path:'/',query:{id:order.platformId}}" type="info">返回首页</van-button>
    <div class="btn">广告位招租</div>
  </div>
</template>

<script>
export default {
  name: "payDetail",
  data() {
    return {
      order: "",
      id: ""
    };
  },
  mounted() {
    this.id = this.$route.query.id;
    this.getDetail();
  },
  methods: {
    getDetail() {
      this.$api.getByOrderId({ id: this.id }).then(res => {
        console.log(res);
        this.order = res.data;
      });
    },
    timeFormat(ts){
      var time = new Date(ts);
      var y = time.getFullYear();
      var m = time.getMonth()+1;
      var d = time.getDate();
      var h = time.getHours();
      var mm = time.getMinutes();
      var s = time.getSeconds();
      return y+'-'+this.add0(m)+'-'+this.add0(d)+' '+this.add0(h)+':'+this.add0(mm)+':'+this.add0(s);
    },
    add0(m){
     return m<10?'0'+m:m 
    }
  }
};
</script>

<style scoped>
.wrapper {
  height: 100vh;
}
.status {
  height: 90px;
  line-height: 90px;
  text-align: center;
  background: #ee473e;
  color: #fff;
}
.img {
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}
.van-button {
  width: 345px;
  height: 49px;
  border-radius: 10px;
  margin: 0 auto;
}
.van-button--info {
  color: #f1190c;
  border-color: #f1190c;
  background: transparent;
}
.btn {
  position: fixed;
  left: 0;
  bottom: 0;
  right: 0;
  height: 60px;
  line-height: 60px;
  text-align: center;
  font-size: 16px;
  background: #a5a5a5;
  color: #fff;
  font-weight: bold;
}
</style>
